//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
//==========================================================================
// Copyright (c) 2000-2004,  Elastos, Inc.  All Rights Reserved.
//**author:hanxu
//**y/m/d:2005/5/16
//==========================================================================

#ifndef __LINUXIO_INCLUDE_H_
#define __LINUXIO_INCLUDE_H_

#define DEVICE_COUNT_COMPATIBLE	4
#define DEVICE_COUNT_IRQ	2
#define DEVICE_COUNT_DMA	2
#define DEVICE_COUNT_RESOURCE	12

struct linux_pci_bus{
	unsigned char   number;         /* bus number */
};

/*
 * The pci_dev structure is used to describe both PCI and ISAPnP devices.
 */
struct pci_dev {
	struct linux_pci_bus	*bus;		/* bus this device is on */

	unsigned int	devfn;		/* encoded device & function index */
	unsigned short	vendor;
	unsigned short	device;
	unsigned short	subsystem_vendor;
	unsigned short	subsystem_device;
	unsigned int	pci_class;		/* 3 bytes: (base,sub,prog-if) */
	unsigned char	hdr_type;	/* PCI header type (`multi' flag masked out) */
	unsigned char	rom_base_reg;	/* which config register controls the ROM */

	/* device is compatible with these IDs */
	unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE];
	unsigned short device_compatible[DEVICE_COUNT_COMPATIBLE];

	/*
	 * Instead of touching interrupt line and base address registers
	 * directly, use the values stored here. They might be different!
	 */
	unsigned int	irq;

	char		name[80];	/* device name */
	char		slot_name[8];	/* slot name */
	int		active;		/* ISAPnP: device is active */
	int		ro;		/* ISAPnP: read only */
	unsigned short	regs;		/* ISAPnP: supported registers */

	int (*prepare)(struct pci_dev *dev);	/* ISAPnP hooks */
	int (*activate)(struct pci_dev *dev);
	int (*deactivate)(struct pci_dev *dev);

	unsigned long	pmontag;  //pci configure write and read tag
	unsigned char busno;

};

#define PCI_CLASS_DISPLAY_VGA 0x0300

extern void _pci_configure (int initialise);

extern struct pci_dev * pci_find_class(unsigned int pci_class);

#endif
